import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import { createRouter, createWebHistory } from "vue-router";
import routes from "./router";
import microApp from "@micro-zoe/micro-app";
import { customLog } from "./utils/log";

microApp.start({
  lifeCycles: {
    created(e, appName) {
      customLog(`子应用${appName}被创建`);
    },
    beforemount(e, appName) {
      customLog(`子应用${appName}即将渲染`);
    },
    mounted(e, appName) {
      customLog(`子应用${appName}已经渲染完成`);
    },
    unmount(e, appName) {
      customLog(`子应用${appName}已经卸载`);
    },
    error(e, appName) {
      customLog(`子应用${appName}加载出错`);
    },
  },
});

const router = createRouter({
  history: createWebHistory(),
  routes,
});

const app = createApp(App);
app.use(router);
app.mount("#app");
